<?php
class ServiceForm extends Zend_Form{
public function __construct($options = null)
	{
		parent::__construct($options);

		// load translator
		$registry = Zend_Registry::getInstance();
		$translate = $registry->get('Zend_Translate');
		$this->addPrefixPath('Vmg_Form_Decorator', 'Vmg/Form/Decorator', 'decorator');

		// set up form
		$this->setName('type');
		$this->setAttrib('id', 'serviceForm');

		// set up empty validator
		$validator = new Zend_Validate_NotEmpty();
		$validator->setMessage("This field is not left empty");
		$validator->setTranslator($translate);

		$id = new Zend_Form_Element_Hidden('id');
		$service_name = new Zend_Form_Element_Text('codeServiceForm');
		$service_name->setLabel($translate->_("Service code"))
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addValidator($validator)
		->setDecorators(array('Composite'))
		->setAttrib('size', 20)
		;


		$service_desc = new Zend_Form_Element_Text('descServiceForm');
		$service_desc->setLabel($translate->_("Service description"))
		->setRequired(false)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->setAttrib('size', 30)
		->setDecorators(array('Composite'))
		;

		$submit = new Zend_Form_Element_Submit('submitServiceForm');
		$submit->setAttrib('id', 'submitServiceForm');
		$submit->setValue($translate->_('Add'));
		$submit->setLabel('');
		$submit->setDecorators(array('Composite'));
		$this->addElements(array($id, $service_name, $service_desc, $submit));
	}
}
?>